<%@ page import="com.nus.beans.User" %>
<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 9/16/12
  Time: 12:55 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Apply leave</title></head>
<body>Developer home page</body>

<% User user = (User) session.getAttribute("user"); %>

<form action="applyLeave.do" method="post">
    <table>
        <tr>
            <td>You have  <%= user.getRemainingLeaves()%> remaining leaves
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="2">
                <% String errorMessage =  (String) request.getAttribute("errorMessage");
                    if(errorMessage != null){%>
                <%=errorMessage%>
                <% } %>
            </td>
        </tr>
        <tr>
            <td>Leave Date: <select name="yearFrom">
                <%for (int i = 2000; i < 2100; i++) {%>
                <option value="<%=i%>"><%=i%>
                </option>
                <%}%>
            </select>
                <select name="monthFrom">
                    <%for (int j = 1; j < 13; j++) {%>
                    <option value="<%=j%>"><%=j%>
                    </option>
                    <%}%>
                </select>
                <select name="dayFrom">
                    <%for (int k = 1; k < 32; k++) {%>
                    <option value="<%=k%>"><%=k%>
                    </option>
                    <%}%>
                </select>
            </td>
            <td></td>
        </tr>
        <tr>
            <td rowspan="2"><% String errorMsg = (String) request.getAttribute("ERROR_MESSAGE");
                if (errorMsg != null) {%>

                <%=errorMsg%>
                <% } %>
            </td>
        </tr>
    </table>
    <input type="submit" value="Apply"/>
    <a href="viewHome.do">Home</a>

</form>
</body>

</html>